<h2>dav.js</h2>
<p>Displays a WebDav Browser window for file picking/opening/saving.</p>
<hr/>

<h3>Functions</h3>
<ul>
  <li><a href="#init">OAT.WebDav.init(options)</a></li>
  <li><a href="#opendialog">OAT.WebDav.openDialog(options)</a></li>
  <li><a href="#savedialog">OAT.WebDav.saveDialog(options)</a></li>
</ul>

<hr/>

<h3><a name="init">OAT.WebDav.init(options)</a></h3>
<p>Creates WebDav Browser window and sets various configuration <em>options</em>, if needed. All possible options:</p>
<ul>
	<li>user - username</li>
	<li>pass - username</li>
	<li>path - path which should be opened</li>
	<li>file - default preselected file name</li>
	<li>extension - ID of default <em>file type</em> extension to be selected</li>
	<li>pathFallback - this is a failsafe path which will be offered when http errors prohibit changing to requested path</li>
	<li>imagePath - path to images, with trailing slash</li>
	<li>imageExt - image files extension</li>
	<li>isDav - whether the server is DAV. For non-DAV http servers, a minimalistic 'prompt' will be used instead of full Browser</li>
	</li>
</ul>

<h3><a name="open">OAT.WebDav.openDialog(options)</a></h3>
<p>Opens the Browser in <em>file browse</em> mode. User can select a file, which will be passed back to application. 
All <em>options</em> passed to <code>init</code> can be used here. Additional specific options:</p>
<ul>
	<li>callback - function to be executed when user selects a file. This will be called with 3 argumens: path, filename and contents.</li>
	<li>extensionFilters - array of file type extensions. Each item consists of 4 values: arbitrary uniqe ID, extension, description and optional content type</li>
</ul>


<h3><a name="open">OAT.WebDav.saveDialog(options)</a></h3>
<p>Opens the Browser in <em>file save</em> mode. User can select a new/existing file, the Browser will then save specified data to that file.
All <em>options</em> passed to <code>init</code> can be used here. Additional specific options:</p>
<ul>
	<li>callback - same as in <code>openDialog</code></li>
	<li>extensionFilters - same as in <code>openDialog</code></li>
	<li>confirmOverwrite - bool, should we ask for a confirmation when overwriting existing file?</li>
	<li>dataCallback - function which provides data to be saved. Will be executed with two arguments: selected file name and used extension ID. 
	You can set dataCallback to <code>false</code>: if you do so, nothing will be saved.</li>
</ul>

<pre class="code">
var options = {
	user:"demo",
	pass:"demo",
	path:"/DAV/home/demo/",
	isDav:true,
	extensionFilters:[
		["all",         "*",   "All files",     "text/plain"],
		["xmldoc",      "xml", "XML Documents", "text/xml"],
		["xmltemplate", "xml", "XML Templates", "application/xml"]
	]
}

OAT.WebDav.init(options);

function showContents(path, file, data) {
	alert(path+file+' contains:\n\n'+data);
}

OAT.WebDav.openDialog({callback:showContents});
</pre>

